//
//  DHPriceSectionCell.m
//  宏达APP
//
//  Created by DIANGHONG on 2018/5/5.
//  Copyright © 2018年 123. All rights reserved.
//

#import "DHPriceSectionCell.h"
@interface DHPriceSectionCell()

@property(nonatomic ,strong)UITextField *minPriceTextField; // 最低价
@property(nonatomic ,strong)UITextField *maxPriceTextField; // 最高价
@property(nonatomic ,strong)UIView *view;

@end
@implementation DHPriceSectionCell

- (UITextField *)minPriceTextField{
    if (!_minPriceTextField) {
        _minPriceTextField = [[UITextField alloc] init];
        _minPriceTextField.placeholder = @"最低价";
        _minPriceTextField.font = [UIFont systemFontOfSize:14];
        [_minPriceTextField setBorderStyle:UITextBorderStyleRoundedRect];
        _minPriceTextField.textAlignment = NSTextAlignmentCenter;
    }
    return _minPriceTextField;
}
- (UITextField *)maxPriceTextField{
    if (!_maxPriceTextField) {
        _maxPriceTextField = [[UITextField alloc] init];
        _maxPriceTextField.placeholder = @"最高价";
        _maxPriceTextField.font = [UIFont systemFontOfSize:14];
        [_maxPriceTextField setBorderStyle:UITextBorderStyleRoundedRect];
        _maxPriceTextField.textAlignment = NSTextAlignmentCenter;

    }
    return _maxPriceTextField;
}
- (UIView *)view{
    if (!_view) {
        _view = [[UIView alloc] init];
        [_view setBackgroundColor:UIColor.lightGrayColor];
    }
    return _view;
}


- (void)layoutSubviews{
    [super layoutSubviews];
    
    [self.contentView addSubview:self.maxPriceTextField];
    [self.contentView addSubview:self.minPriceTextField];
    [self.contentView addSubview:self.view];

    
    self.view.bounds = CGRectMake(0, 0, 20, 2);
    CGFloat textViewW = (self.bounds.size.width - self.view.bounds.size.width - 2 * 10) / 2;
    CGFloat textViewH = self.bounds.size.height - 2 * 10;
  //  CGFloat viewY = self.bounds.size.height - 2 / 2;
    self.minPriceTextField.frame = CGRectMake(8, 5, textViewW, textViewH);
    self.view.frame = CGRectMake(CGRectGetMaxX(self.minPriceTextField.frame) + 10 , 5 + textViewH / 2, 10, 2);
    self.maxPriceTextField.frame = CGRectMake(CGRectGetMaxX(self.view.frame) + 10, 5, textViewW, textViewH);
}

@end
